package com.zcf.gameController.gameUtils;
import java.util.ArrayList;
import java.util.List;

/**
 * 推筒子
 * @author jj
 * @date 2019/11/16 11:05
 */
public class HandPattern {
    public final static int[] tbrands = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9 };
    final  List<String> tsCards = new ArrayList<String> ();
//-------------------------特殊牌型--------------------------------------------------------
    /**
     * 推筒子
     */
    private void ts(){
        for (int i=0;i<tbrands.length;i=i+2){
            tsCards.add(tbrands[i]+"&"+tbrands[i+1]);
        }
    }
    HandPattern(){
        ts();
    }


    /**
     * 判断用户手里的牌---特殊牌型
     * 推筒子
     */
    public  Integer isTs(List<Integer> list) {
        // 拼接字符串
        String pj = tbrands[list.get(0)] + "&" +tbrands[list.get(1)];
        if (tsCards.contains(pj)){
          return tsCards.indexOf(pj);
        }
        return -1;
    }

    /**
     * 判断用户手里的牌---特殊牌型
     * 推筒子
     */
    public  double sum(List<Integer> list) {
        // 拼接字符串
        double p1 = tbrands[list.get(0)];
        double p2 = tbrands[list.get(1)];
        if (p1==0){
            p1=0.5;
        }
        if (p2==0){
            p2=0.5;
        }
        return p1+p2;
    }
    public static void main(String[] args) {
        HandPattern ps=new HandPattern();
        System.out.println(ps.tsCards);
    }
}
